package com.i2works.smartluolong.web.controller.index;

import com.google.common.collect.Lists;
import com.i2works.smartluolong.utils.entity.ListParamsQuery;
import com.i2works.smartluolong.utils.entity.R;
import com.i2works.smartluolong.utils.entity.Result;
import com.i2works.smartluolong.utils.exception.ServiceException;
import com.i2works.smartluolong.web.entity.Implement.ImplementDO;
import com.i2works.smartluolong.web.entity.Implement.ImplementQuery;
import com.i2works.smartluolong.web.entity.common.SearchParam;
import com.i2works.smartluolong.web.entity.item.ItemApasinfoDO;
import com.i2works.smartluolong.web.entity.item.ItemApasinfoQuery;
import com.i2works.smartluolong.web.entity.items.ItemsCategoryDO;
import com.i2works.smartluolong.web.entity.items.ItemsCategoryQuery;
import com.i2works.smartluolong.web.service.implement.IImplementService;
import com.i2works.smartluolong.web.service.item.IItemApasinfoService;
import com.i2works.smartluolong.web.service.items.IItemsCategoryService;
import com.i2works.smartluolong.web.utils.BaseModule;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping({"/transactShow"})
public class TransactShowController extends BaseModule{
    
  @Autowired
  private  IItemApasinfoService  itemApasinfoService;
	
  @GetMapping("/index")
  public String index(Model model) {
	  return "/transactShow";
  }
  
  @RequestMapping("/list")
  @ResponseBody
  public Result list(ItemApasinfoQuery itemsQuery ){
    try
    {
        List<ItemApasinfoDO> itemsList = Lists.newArrayList();
        Integer itemCount = itemApasinfoService.queryCount(itemsQuery);
        if (itemCount > 0) {
            itemsList = itemApasinfoService.queryList(itemsQuery);
        }
        return  R.success(itemsList,itemCount);
    } catch (ServiceException e) {
      return R.error();
    }
  }
}